package com.tony.spring.mode.factory;

/***
 * 工厂模式
 * @author Tony
 *
 */
public class FactoryMode {
	
	/**
	 * 获取支付宝实例 
	 * @return
	 * @throws Exception 
	 */
	public static Payment getPayment(String payFlag) throws Exception{
		if(payFlag =="Wx"){
			return new WxPayment();
		} else if(payFlag =="Ali"){
			return new AliPayment();
		} else {
			throw new Exception("支付信息不存在");
		}
	}

}
